/**
 * This is the router for all of the request from clients
 * It will do:
 * (1) audit the request data ;
 * (2) save the request data;
 */

module.exports = function (app) {
    logger.debug("load the filter-route module....");
    var preprocess = require('../filters/preprocess-filter');
    var requestToken = require('../filters/token-filter');
    var requestAudit = require('../filters/audit-filter');
    var md5Validate = require('../filters/md5Validate-filter');
    var urlParser= require('../filters/url-filter');
    var backOffice= require('../filters/backOffice-filter');
    var doSetResHead= require('../filters/responseFilter');
    /* 宝宝树66小区三期改造 旧版本宝宝树66小区APP提示下载最新版本APP add wangcan 20180927 start */
    var appUpdate = require('../filters/appUpdate-filter');

    app.all('/rest/' + RESTFullServiceVersion + '/*', md5Validate.md5Validate, preprocess.preprocess, requestAudit.doAuditRequest, urlParser.doParser,doSetResHead.doSetResHead, appUpdate.appUpdate);
    // app.all('/rest/' + RESTFullServiceVersion + '/*', md5Validate.md5Validate, preprocess.preprocess, requestAudit.doAuditRequest, urlParser.doParser,doSetResHead.doSetResHead);
    /* 宝宝树66小区三期改造 旧版本宝宝树66小区APP提示下载最新版本APP add wangcan 20180927 end */
    app.post('/rest/' + RESTFullServiceVersion + '/backoffice/*', backOffice.saveBehavior);
}
